package pers.kw.server.controller;

import org.springframework.web.bind.annotation.RestController;
import pers.kw.api.AccountApi;
import pers.kw.dto.UpdateAcctBalanceReqDto;
import pers.kw.protocol.R;
import pers.kw.server.service.AccountService;

import javax.annotation.Resource;
import java.math.BigDecimal;

@RestController
public class AccountController implements AccountApi {

    @Resource
    private AccountService accountService;

    @Override
    public R<BigDecimal> queryAcctBalance(String userNo) {
        return R.ok(accountService.queryAcctBalance(userNo));
    }

    @Override
    public R<String> updateAcctBalance(UpdateAcctBalanceReqDto reqDto) {
        accountService.updateAcctBalance(reqDto);
        return R.ok("扣减账户余额成功");
    }
}
